using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;

using SharpCore.Data;

namespace TF.Access {
	public partial class TF_UserProfile {
		#region Fields
		private int uid;
		private string cN_Name;
		private string eN_Name;
		private int countryID;
		private int provinceID;
		private int cityID;
		private int districtId;
		private string pwd;
		private string nick_Name;
		private string gender;
		private string home;
		private string email;
		private string birthYear;
		private string birthMonth;
		private string birthDay;
		private string interesting_Place;
		private byte isRegister;
		private byte isBlogProhibited;
		private int homeProvinceId;
		private int homeCityId;
		private string pic;
		private string mobilePhone;
		private string qQ;
		private string mSN;
		private byte isPublicGender;
		private byte isPublicBirthDay;
		private byte isPublicHome;
		private byte isPublicAddress;
		private DateTime keyin_date = System.Data.SqlTypes.SqlDateTime.MinValue.Value;
		private DateTime modi_date = System.Data.SqlTypes.SqlDateTime.MinValue.Value;
		#endregion
		
		#region Constructors
		/// <summary>
		/// Initializes a new instance of the TF_UserProfile class.
		/// </summary>
		public TF_UserProfile() {
		}
		
		/// <summary>
		/// Initializes a new instance of the TF_UserProfile class.
		/// </summary>
		public TF_UserProfile(string cN_Name, string eN_Name, int countryID, int provinceID, int cityID, int districtId, string pwd, string nick_Name, string gender, string home, string email, string birthYear, string birthMonth, string birthDay, string interesting_Place, byte isRegister, byte isBlogProhibited, int homeProvinceId, int homeCityId, string pic, string mobilePhone, string qQ, string mSN, byte isPublicGender, byte isPublicBirthDay, byte isPublicHome, byte isPublicAddress, DateTime keyin_date, DateTime modi_date) {
			this.cN_Name = cN_Name;
			this.eN_Name = eN_Name;
			this.countryID = countryID;
			this.provinceID = provinceID;
			this.cityID = cityID;
			this.districtId = districtId;
			this.pwd = pwd;
			this.nick_Name = nick_Name;
			this.gender = gender;
			this.home = home;
			this.email = email;
			this.birthYear = birthYear;
			this.birthMonth = birthMonth;
			this.birthDay = birthDay;
			this.interesting_Place = interesting_Place;
			this.isRegister = isRegister;
			this.isBlogProhibited = isBlogProhibited;
			this.homeProvinceId = homeProvinceId;
			this.homeCityId = homeCityId;
			this.pic = pic;
			this.mobilePhone = mobilePhone;
			this.qQ = qQ;
			this.mSN = mSN;
			this.isPublicGender = isPublicGender;
			this.isPublicBirthDay = isPublicBirthDay;
			this.isPublicHome = isPublicHome;
			this.isPublicAddress = isPublicAddress;
			this.keyin_date = keyin_date;
			this.modi_date = modi_date;
		}
		
		/// <summary>
		/// Initializes a new instance of the TF_UserProfile class.
		/// </summary>
		public TF_UserProfile(int uid, string cN_Name, string eN_Name, int countryID, int provinceID, int cityID, int districtId, string pwd, string nick_Name, string gender, string home, string email, string birthYear, string birthMonth, string birthDay, string interesting_Place, byte isRegister, byte isBlogProhibited, int homeProvinceId, int homeCityId, string pic, string mobilePhone, string qQ, string mSN, byte isPublicGender, byte isPublicBirthDay, byte isPublicHome, byte isPublicAddress, DateTime keyin_date, DateTime modi_date) {
			this.uid = uid;
			this.cN_Name = cN_Name;
			this.eN_Name = eN_Name;
			this.countryID = countryID;
			this.provinceID = provinceID;
			this.cityID = cityID;
			this.districtId = districtId;
			this.pwd = pwd;
			this.nick_Name = nick_Name;
			this.gender = gender;
			this.home = home;
			this.email = email;
			this.birthYear = birthYear;
			this.birthMonth = birthMonth;
			this.birthDay = birthDay;
			this.interesting_Place = interesting_Place;
			this.isRegister = isRegister;
			this.isBlogProhibited = isBlogProhibited;
			this.homeProvinceId = homeProvinceId;
			this.homeCityId = homeCityId;
			this.pic = pic;
			this.mobilePhone = mobilePhone;
			this.qQ = qQ;
			this.mSN = mSN;
			this.isPublicGender = isPublicGender;
			this.isPublicBirthDay = isPublicBirthDay;
			this.isPublicHome = isPublicHome;
			this.isPublicAddress = isPublicAddress;
			this.keyin_date = keyin_date;
			this.modi_date = modi_date;
		}
		#endregion
		
		#region Properties
		/// <summary>
		/// Gets or sets the Uid value.
		/// </summary>
		public int Uid {
			get { return uid; }
			set { uid = value; }
		}
		
		/// <summary>
		/// Gets or sets the CN_Name value.
		/// </summary>
		public string CN_Name {
			get { return cN_Name; }
			set { cN_Name = value; }
		}
		
		/// <summary>
		/// Gets or sets the EN_Name value.
		/// </summary>
		public string EN_Name {
			get { return eN_Name; }
			set { eN_Name = value; }
		}
		
		/// <summary>
		/// Gets or sets the CountryID value.
		/// </summary>
		public int CountryID {
			get { return countryID; }
			set { countryID = value; }
		}
		
		/// <summary>
		/// Gets or sets the ProvinceID value.
		/// </summary>
		public int ProvinceID {
			get { return provinceID; }
			set { provinceID = value; }
		}
		
		/// <summary>
		/// Gets or sets the CityID value.
		/// </summary>
		public int CityID {
			get { return cityID; }
			set { cityID = value; }
		}
		
		/// <summary>
		/// Gets or sets the DistrictId value.
		/// </summary>
		public int DistrictId {
			get { return districtId; }
			set { districtId = value; }
		}
		
		/// <summary>
		/// Gets or sets the Pwd value.
		/// </summary>
		public string Pwd {
			get { return pwd; }
			set { pwd = value; }
		}
		
		/// <summary>
		/// Gets or sets the Nick_Name value.
		/// </summary>
		public string Nick_Name {
			get { return nick_Name; }
			set { nick_Name = value; }
		}
		
		/// <summary>
		/// Gets or sets the Gender value.
		/// </summary>
		public string Gender {
			get { return gender; }
			set { gender = value; }
		}
		
		/// <summary>
		/// Gets or sets the Home value.
		/// </summary>
		public string Home {
			get { return home; }
			set { home = value; }
		}
		
		/// <summary>
		/// Gets or sets the Email value.
		/// </summary>
		public string Email {
			get { return email; }
			set { email = value; }
		}
		
		/// <summary>
		/// Gets or sets the BirthYear value.
		/// </summary>
		public string BirthYear {
			get { return birthYear; }
			set { birthYear = value; }
		}
		
		/// <summary>
		/// Gets or sets the BirthMonth value.
		/// </summary>
		public string BirthMonth {
			get { return birthMonth; }
			set { birthMonth = value; }
		}
		
		/// <summary>
		/// Gets or sets the BirthDay value.
		/// </summary>
		public string BirthDay {
			get { return birthDay; }
			set { birthDay = value; }
		}
		
		/// <summary>
		/// Gets or sets the Interesting_Place value.
		/// </summary>
		public string Interesting_Place {
			get { return interesting_Place; }
			set { interesting_Place = value; }
		}
		
		/// <summary>
		/// Gets or sets the IsRegister value.
		/// </summary>
		public byte IsRegister {
			get { return isRegister; }
			set { isRegister = value; }
		}
		
		/// <summary>
		/// Gets or sets the IsBlogProhibited value.
		/// </summary>
		public byte IsBlogProhibited {
			get { return isBlogProhibited; }
			set { isBlogProhibited = value; }
		}
		
		/// <summary>
		/// Gets or sets the HomeProvinceId value.
		/// </summary>
		public int HomeProvinceId {
			get { return homeProvinceId; }
			set { homeProvinceId = value; }
		}
		
		/// <summary>
		/// Gets or sets the HomeCityId value.
		/// </summary>
		public int HomeCityId {
			get { return homeCityId; }
			set { homeCityId = value; }
		}
		
		/// <summary>
		/// Gets or sets the Pic value.
		/// </summary>
		public string Pic {
			get { return pic; }
			set { pic = value; }
		}
		
		/// <summary>
		/// Gets or sets the MobilePhone value.
		/// </summary>
		public string MobilePhone {
			get { return mobilePhone; }
			set { mobilePhone = value; }
		}
		
		/// <summary>
		/// Gets or sets the QQ value.
		/// </summary>
		public string QQ {
			get { return qQ; }
			set { qQ = value; }
		}
		
		/// <summary>
		/// Gets or sets the MSN value.
		/// </summary>
		public string MSN {
			get { return mSN; }
			set { mSN = value; }
		}
		
		/// <summary>
		/// Gets or sets the IsPublicGender value.
		/// </summary>
		public byte IsPublicGender {
			get { return isPublicGender; }
			set { isPublicGender = value; }
		}
		
		/// <summary>
		/// Gets or sets the IsPublicBirthDay value.
		/// </summary>
		public byte IsPublicBirthDay {
			get { return isPublicBirthDay; }
			set { isPublicBirthDay = value; }
		}
		
		/// <summary>
		/// Gets or sets the IsPublicHome value.
		/// </summary>
		public byte IsPublicHome {
			get { return isPublicHome; }
			set { isPublicHome = value; }
		}
		
		/// <summary>
		/// Gets or sets the IsPublicAddress value.
		/// </summary>
		public byte IsPublicAddress {
			get { return isPublicAddress; }
			set { isPublicAddress = value; }
		}
		
		/// <summary>
		/// Gets or sets the Keyin_date value.
		/// </summary>
		public DateTime Keyin_date {
			get { return keyin_date; }
			set { keyin_date = value; }
		}
		
		/// <summary>
		/// Gets or sets the Modi_date value.
		/// </summary>
		public DateTime Modi_date {
			get { return modi_date; }
			set { modi_date = value; }
		}
		#endregion
		
		#region Methods
		/// <summary>
		/// Saves a record to the TF_UserProfile table.
		/// </summary>
		public void Insert() {
			uid = Convert.ToInt32(SqlClientUtility.ExecuteScalar("TF_UserProfileInsert", cN_Name, eN_Name, countryID, provinceID, cityID, districtId, pwd, nick_Name, gender, home, email, birthYear, birthMonth, birthDay, interesting_Place, isRegister, isBlogProhibited, homeProvinceId, homeCityId, pic, mobilePhone, qQ, mSN, isPublicGender, isPublicBirthDay, isPublicHome, isPublicAddress, keyin_date, modi_date));
		}
		
		/// <summary>
		/// Updates a record in the TF_UserProfile table.
		/// </summary>
		public void Update() {
			SqlClientUtility.ExecuteNonQuery("TF_UserProfileUpdate", uid, cN_Name, eN_Name, countryID, provinceID, cityID, districtId, pwd, nick_Name, gender, home, email, birthYear, birthMonth, birthDay, interesting_Place, isRegister, isBlogProhibited, homeProvinceId, homeCityId, pic, mobilePhone, qQ, mSN, isPublicGender, isPublicBirthDay, isPublicHome, isPublicAddress, keyin_date, modi_date);
		}
		
		/// <summary>
		/// Deletes a record from the TF_UserProfile table by its primary key.
		/// </summary>
		public void Delete() {
			SqlClientUtility.ExecuteNonQuery("TF_UserProfileDelete", uid);
		}
		
		/// <summary>
		/// Selects a single record from the TF_UserProfile table.
		/// </summary>
		public static TF_UserProfile Select(int uid) {
			using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader("TF_UserProfileSelect", uid)) {
				if (dataReader.Read()) {
					return MakeTF_UserProfile(dataReader);
				} else {
					return null;
				}
			}
		}
		
		/// <summary>
		/// Selects all records from the TF_UserProfile table.
		/// </summary>
		public static List<TF_UserProfile> SelectAll() {
			using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader("TF_UserProfileSelectAll")) {
				List<TF_UserProfile> tF_UserProfileList = new List<TF_UserProfile>();
				while (dataReader.Read()) {
					TF_UserProfile tF_UserProfile = MakeTF_UserProfile(dataReader);
					tF_UserProfileList.Add(tF_UserProfile);
				}
				return tF_UserProfileList;
			}
		}
		
		/// <summary>
		/// Creates a new instance of the TF_UserProfile class and populates it with data from the specified SqlDataReader.
		/// </summary>
		private static TF_UserProfile MakeTF_UserProfile(SqlDataReader dataReader) {
			TF_UserProfile tF_UserProfile = new TF_UserProfile();
			
			if (dataReader.IsDBNull(0) == false) {
				tF_UserProfile.Uid = dataReader.GetInt32(0);
			}
			if (dataReader.IsDBNull(1) == false) {
				tF_UserProfile.CN_Name = dataReader.GetString(1);
			}
			if (dataReader.IsDBNull(2) == false) {
				tF_UserProfile.EN_Name = dataReader.GetString(2);
			}
			if (dataReader.IsDBNull(3) == false) {
				tF_UserProfile.CountryID = dataReader.GetInt32(3);
			}
			if (dataReader.IsDBNull(4) == false) {
				tF_UserProfile.ProvinceID = dataReader.GetInt32(4);
			}
			if (dataReader.IsDBNull(5) == false) {
				tF_UserProfile.CityID = dataReader.GetInt32(5);
			}
			if (dataReader.IsDBNull(6) == false) {
				tF_UserProfile.DistrictId = dataReader.GetInt32(6);
			}
			if (dataReader.IsDBNull(7) == false) {
				tF_UserProfile.Pwd = dataReader.GetString(7);
			}
			if (dataReader.IsDBNull(8) == false) {
				tF_UserProfile.Nick_Name = dataReader.GetString(8);
			}
			if (dataReader.IsDBNull(9) == false) {
				tF_UserProfile.Gender = dataReader.GetString(9);
			}
			if (dataReader.IsDBNull(10) == false) {
				tF_UserProfile.Home = dataReader.GetString(10);
			}
			if (dataReader.IsDBNull(11) == false) {
				tF_UserProfile.Email = dataReader.GetString(11);
			}
			if (dataReader.IsDBNull(12) == false) {
				tF_UserProfile.BirthYear = dataReader.GetString(12);
			}
			if (dataReader.IsDBNull(13) == false) {
				tF_UserProfile.BirthMonth = dataReader.GetString(13);
			}
			if (dataReader.IsDBNull(14) == false) {
				tF_UserProfile.BirthDay = dataReader.GetString(14);
			}
			if (dataReader.IsDBNull(15) == false) {
				tF_UserProfile.Interesting_Place = dataReader.GetString(15);
			}
			if (dataReader.IsDBNull(16) == false) {
				tF_UserProfile.IsRegister = dataReader.GetByte(16);
			}
			if (dataReader.IsDBNull(17) == false) {
				tF_UserProfile.IsBlogProhibited = dataReader.GetByte(17);
			}
			if (dataReader.IsDBNull(18) == false) {
				tF_UserProfile.HomeProvinceId = dataReader.GetInt32(18);
			}
			if (dataReader.IsDBNull(19) == false) {
				tF_UserProfile.HomeCityId = dataReader.GetInt32(19);
			}
			if (dataReader.IsDBNull(20) == false) {
				tF_UserProfile.Pic = dataReader.GetString(20);
			}
			if (dataReader.IsDBNull(21) == false) {
				tF_UserProfile.MobilePhone = dataReader.GetString(21);
			}
			if (dataReader.IsDBNull(22) == false) {
				tF_UserProfile.QQ = dataReader.GetString(22);
			}
			if (dataReader.IsDBNull(23) == false) {
				tF_UserProfile.MSN = dataReader.GetString(23);
			}
			if (dataReader.IsDBNull(24) == false) {
				tF_UserProfile.IsPublicGender = dataReader.GetByte(24);
			}
			if (dataReader.IsDBNull(25) == false) {
				tF_UserProfile.IsPublicBirthDay = dataReader.GetByte(25);
			}
			if (dataReader.IsDBNull(26) == false) {
				tF_UserProfile.IsPublicHome = dataReader.GetByte(26);
			}
			if (dataReader.IsDBNull(27) == false) {
				tF_UserProfile.IsPublicAddress = dataReader.GetByte(27);
			}
			if (dataReader.IsDBNull(28) == false) {
				tF_UserProfile.Keyin_date = dataReader.GetDateTime(28);
			}
			if (dataReader.IsDBNull(29) == false) {
				tF_UserProfile.Modi_date = dataReader.GetDateTime(29);
			}

			return tF_UserProfile;
		}
		#endregion
	}
}
